{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "A, B, C, D = 1, .2, 1.4, 10\n",
    "\n",
    "\n",
    "def Fn(t, A, B, C, D):\n",
    "    return A*np.exp(-B*t)*np.sin(C*t) + D\n",
    "\n",
    "np.random.seed(234567)\n",
    "n_pts = 1000\n",
    "t = np.linspace(1,20,n_pts) + .3*np.random.rand(n_pts)\n",
    "y_true = Fn(t, A, B, C, D)\n",
    "y_meas = y_true + .11*(0.5 - np.random.rand(n_pts))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([10.83080057, 10.76072448, 10.80183891, 10.79389563, 10.77499642,\n",
       "       10.77731162, 10.71547301, 10.70364987, 10.76001412, 10.74954667,\n",
       "       10.76547441, 10.65386229, 10.60847621, 10.67182074, 10.70577339,\n",
       "       10.73260677, 10.61684792, 10.65392299, 10.55499214, 10.53541983,\n",
       "       10.50847105, 10.63280627, 10.64905569, 10.48094519, 10.55413772,\n",
       "       10.53762083, 10.49823799, 10.48227126, 10.54618498, 10.42105591,\n",
       "       10.53976767, 10.3459495 , 10.37889734, 10.39105304, 10.49308916,\n",
       "       10.2861824 , 10.41056433, 10.4011726 , 10.35107547, 10.21311408,\n",
       "       10.38821218, 10.35736133, 10.26678475, 10.09807771, 10.32755084,\n",
       "       10.07083283, 10.18089885, 10.21846038, 10.19505435, 10.19710021,\n",
       "       10.09234229, 10.03706578, 10.16974489, 10.08782536, 10.0992142 ,\n",
       "       10.14367236,  9.96666607, 10.08882669,  9.9564646 , 10.00913263,\n",
       "        9.99548657,  9.95015711,  9.93929643,  9.85836668,  9.76573724,\n",
       "        9.89652304,  9.83163707,  9.7699356 ,  9.74011843,  9.76744952,\n",
       "        9.87690174,  9.77292194,  9.85505544,  9.81826732,  9.64207837,\n",
       "        9.65820457,  9.63335855,  9.70735442,  9.74430945,  9.79663816,\n",
       "        9.70213947,  9.58016004,  9.69545434,  9.73584688,  9.65154497,\n",
       "        9.55107113,  9.5562821 ,  9.58701365,  9.64913109,  9.55688886,\n",
       "        9.47874006,  9.53495438,  9.59389727,  9.49539361,  9.57025886,\n",
       "        9.57457219,  9.44204789,  9.47498836,  9.54245789,  9.5438623 ,\n",
       "        9.54264527,  9.46298377,  9.50471047,  9.44740684,  9.46576348,\n",
       "        9.51739453,  9.45062175,  9.54772513,  9.45096212,  9.44703518,\n",
       "        9.49478119,  9.43198605,  9.47008483,  9.51154403,  9.43490073,\n",
       "        9.54237094,  9.51691097,  9.53292078,  9.46895132,  9.5467288 ,\n",
       "        9.47495845,  9.51453815,  9.48489742,  9.51481653,  9.54921634,\n",
       "        9.48081708,  9.5514588 ,  9.49624245,  9.56916924,  9.49923164,\n",
       "        9.48609463,  9.624546  ,  9.54255732,  9.6357741 ,  9.62380374,\n",
       "        9.56411849,  9.56749577,  9.65234016,  9.54668218,  9.61574041,\n",
       "        9.56548011,  9.61046691,  9.66641863,  9.69153889,  9.71523977,\n",
       "        9.72463739,  9.80289418,  9.76006587,  9.70739942,  9.7182453 ,\n",
       "        9.67487332,  9.69486947,  9.74558662,  9.81672068,  9.65235257,\n",
       "        9.80758174,  9.71739372,  9.88058728,  9.84077641,  9.86578984,\n",
       "        9.83567869,  9.77018188,  9.9254003 ,  9.87693632,  9.89817098,\n",
       "        9.96644749,  9.77495788,  9.79033171,  9.7978586 ,  9.8336985 ,\n",
       "        9.87666052,  9.85378919,  9.95217069,  9.95207474, 10.04190171,\n",
       "        9.95838225, 10.03319727, 10.04308125,  9.92640515, 10.00686894,\n",
       "       10.0605739 , 10.00811998, 10.12654492, 10.02217107, 10.07455935,\n",
       "       10.05740762, 10.04638886, 10.14871045, 10.11118313, 10.16893009,\n",
       "       10.0514269 , 10.10645071, 10.08920018, 10.16134664, 10.28148799,\n",
       "       10.22345279, 10.15212787, 10.18926156, 10.25143321, 10.18756606,\n",
       "       10.24906913, 10.20453632, 10.26397063, 10.18020637, 10.33120609,\n",
       "       10.32414466, 10.28667009, 10.30193365, 10.25551817, 10.27374364,\n",
       "       10.29156357, 10.23706194, 10.27117313, 10.27084213, 10.30844512,\n",
       "       10.31894396, 10.26988265, 10.29566076, 10.29639621, 10.27107986,\n",
       "       10.34886306, 10.28392164, 10.36888355, 10.36381993, 10.31959132,\n",
       "       10.29737353, 10.29049587, 10.3778446 , 10.35440367, 10.26929582,\n",
       "       10.30141032, 10.37605179, 10.37857153, 10.35967963, 10.34564911,\n",
       "       10.36019421, 10.3115091 , 10.32462719, 10.30630622, 10.25941477,\n",
       "       10.29565771, 10.32331764, 10.33383062, 10.32021107, 10.304694  ,\n",
       "       10.32168506, 10.31121857, 10.29916334, 10.3657678 , 10.32631089,\n",
       "       10.32820154, 10.28922288, 10.22423071, 10.1977267 , 10.26609153,\n",
       "       10.22831103, 10.30815247, 10.31828397, 10.24033946, 10.32201749,\n",
       "       10.21437785, 10.26605531, 10.25229102, 10.25839563, 10.11088207,\n",
       "       10.21930183, 10.25954955, 10.21422194, 10.15026329, 10.27220891,\n",
       "       10.1159854 , 10.12271294, 10.2021055 , 10.09710995, 10.08137233,\n",
       "       10.10885394, 10.08204001, 10.06659531, 10.13045692, 10.08701149,\n",
       "       10.15527901, 10.15726147, 10.00878601, 10.15745514, 10.07984122,\n",
       "       10.15246341, 10.04467313, 10.03548507,  9.96798622, 10.01375686,\n",
       "       10.01728487, 10.10175791, 10.02029525,  9.97389009, 10.019628  ,\n",
       "        9.90259664, 10.05743838,  9.96994742,  9.91775368, 10.00830554,\n",
       "        9.92380903,  9.9535306 ,  9.95128862,  9.91881197,  9.92660575,\n",
       "        9.90482737,  9.88776126,  9.88488591,  9.99390549,  9.84296599,\n",
       "        9.81493079,  9.91287229,  9.95062182,  9.89958422,  9.84834781,\n",
       "        9.85474441,  9.89654144,  9.87106219,  9.89259211,  9.79051257,\n",
       "        9.8680896 ,  9.90190432,  9.81463642,  9.81957112,  9.81529786,\n",
       "        9.86920352,  9.76303558,  9.86901376,  9.78029778,  9.85752579,\n",
       "        9.78042092,  9.83341746,  9.78763514,  9.75851924,  9.82454032,\n",
       "        9.83848814,  9.83035721,  9.75739883,  9.77469962,  9.82417019,\n",
       "        9.76961173,  9.74072304,  9.80191824,  9.7696521 ,  9.80301687,\n",
       "        9.8075512 ,  9.7840911 ,  9.7974711 ,  9.80695644,  9.79974212,\n",
       "        9.8108173 ,  9.76897518,  9.79124058,  9.82322987,  9.82681914,\n",
       "        9.76787701,  9.81303631,  9.84073407,  9.80532516,  9.82920301,\n",
       "        9.80583268,  9.8120779 ,  9.84333259,  9.78805197,  9.81989919,\n",
       "        9.7779771 ,  9.75584116,  9.83399717,  9.79196068,  9.80759822,\n",
       "        9.89956498,  9.84588032,  9.87062377,  9.83610728,  9.83383653,\n",
       "        9.7710769 ,  9.83631386,  9.82374346,  9.83701532,  9.90113431,\n",
       "        9.84773158,  9.83788902,  9.86779398,  9.86843395,  9.84240218,\n",
       "        9.8999324 ,  9.85782853,  9.83805414,  9.93095479,  9.92789356,\n",
       "        9.94113017,  9.88190199,  9.87034461,  9.9318931 ,  9.92525473,\n",
       "        9.87151596,  9.92595332,  9.92969951,  9.9798536 ,  9.98185045,\n",
       "        9.9536841 ,  9.96181771,  9.95418165,  9.95828595,  9.89558756,\n",
       "        9.99248076,  9.99268926,  9.98364564, 10.00425581,  9.99808832,\n",
       "        9.98409547,  9.96314317, 10.03800386, 10.00659615, 10.01178758,\n",
       "        9.98494562,  9.95989098, 10.03424056,  9.97090508, 10.02581607,\n",
       "       10.0684977 , 10.01898669, 10.04747873, 10.04125984, 10.069167  ,\n",
       "       10.05547214, 10.06891604, 10.10561576, 10.00132892, 10.00357553,\n",
       "       10.04200417, 10.01819241, 10.07857209, 10.07688619, 10.05366853,\n",
       "       10.11362689, 10.04870147, 10.076871  , 10.13664292, 10.12008516,\n",
       "       10.06831027, 10.14637215, 10.11924873, 10.08603585, 10.13667831,\n",
       "       10.1118831 , 10.14103576, 10.11203986, 10.18116749, 10.14670156,\n",
       "       10.09376153, 10.10122651, 10.16571238, 10.14625268, 10.16282092,\n",
       "       10.15288872, 10.08786117, 10.09448895, 10.10369518, 10.15728754,\n",
       "       10.08401852, 10.08606825, 10.07693695, 10.11366237, 10.12397245,\n",
       "       10.11940304, 10.12981134, 10.10161315, 10.15223664, 10.15780578,\n",
       "       10.16911123, 10.13921738, 10.12685227, 10.13284468, 10.11662987,\n",
       "       10.07922744, 10.16574002, 10.13060189, 10.17328031, 10.07306337,\n",
       "       10.07883862, 10.12711689, 10.06270492, 10.09131243, 10.14883692,\n",
       "       10.12534352, 10.11256071, 10.08369092, 10.0587252 , 10.10746497,\n",
       "       10.08584908, 10.13927268, 10.13999063, 10.15845382, 10.09183429,\n",
       "       10.14170921, 10.06288423, 10.07305103, 10.07545351, 10.12023798,\n",
       "       10.08482378, 10.08406402, 10.09727925, 10.10929587, 10.10288617,\n",
       "       10.03914877, 10.08405064, 10.10094567, 10.00503783, 10.00457943,\n",
       "        9.99780301,  9.98957227,  9.98779386, 10.04632998, 10.08191489,\n",
       "       10.03881112, 10.04009018, 10.05788605, 10.0675381 , 10.03314554,\n",
       "       10.07078759, 10.07478969, 10.02908524,  9.96960144, 10.00763792,\n",
       "       10.05764062,  9.96523569, 10.06162463,  9.98117149, 10.00655161,\n",
       "       10.05982885,  9.94714284, 10.03456268,  9.98514987,  9.96279176,\n",
       "       10.02076924,  9.99924578, 10.02738655, 10.0046156 ,  9.9377969 ,\n",
       "        9.98478953, 10.03880246,  9.92399984,  9.92412917,  9.93500773,\n",
       "        9.95010061,  9.98900458,  9.96343124,  9.88930436,  9.90634307,\n",
       "        9.89892605,  9.98224953,  9.95124019,  9.89979664,  9.95599765,\n",
       "        9.9513566 ,  9.90255506,  9.93760803,  9.97513735,  9.9844995 ,\n",
       "        9.96295422,  9.89510567,  9.88653195,  9.95839144,  9.97129721,\n",
       "        9.9148827 ,  9.95154792,  9.91490264,  9.90742124,  9.87830857,\n",
       "        9.95317994,  9.96464691,  9.93792976,  9.86836485,  9.89794987,\n",
       "        9.95574407,  9.93678924,  9.87142256,  9.91513662,  9.9136004 ,\n",
       "        9.91023626,  9.95799859,  9.90111932,  9.92287166,  9.9441586 ,\n",
       "        9.86057873,  9.87837832,  9.90763888,  9.87108428,  9.91674557,\n",
       "        9.92507551,  9.90877341,  9.93554913,  9.89171069,  9.89988742,\n",
       "        9.89391501,  9.96826265,  9.96486435,  9.9184461 ,  9.89576418,\n",
       "        9.94992393,  9.96749486,  9.96659401,  9.91487621,  9.91477611,\n",
       "        9.96638464,  9.96966362,  9.89147503,  9.93146779,  9.89107664,\n",
       "        9.98909891,  9.97667169,  9.88687474,  9.93857174,  9.9832544 ,\n",
       "        9.98499388,  9.99209681,  9.93548912,  9.92884349,  9.96922246,\n",
       "        9.93163203,  9.92325381,  9.98326878,  9.94146353, 10.0046489 ,\n",
       "        9.92825479,  9.99431356,  9.90284563,  9.91724583,  9.93293099,\n",
       "        9.95381694, 10.02590118,  9.92572817,  9.94221327, 10.00683034,\n",
       "        9.93293621, 10.00800768, 10.0142698 ,  9.95050416, 10.0199961 ,\n",
       "       10.01606952, 10.00039732, 10.01704375, 10.02773333,  9.98089079,\n",
       "       10.06133386, 10.00225851, 10.04190434, 10.02784303,  9.99460122,\n",
       "        9.98271702, 10.00764041,  9.95550139,  9.96539751, 10.02724346,\n",
       "        9.96634121, 10.01209812, 10.00523336, 10.05759564, 10.0496345 ,\n",
       "       10.00354348,  9.99183418,  9.98324853, 10.0055179 ,  9.98413044,\n",
       "        9.99225142, 10.08569383, 10.03581666, 10.01370338,  9.99958948,\n",
       "       10.0108883 , 10.05200979, 10.08341815,  9.98712266, 10.08910297,\n",
       "       10.06442453, 10.08821821,  9.98392756, 10.0512125 , 10.04510946,\n",
       "       10.08402478, 10.09025376, 10.09204873, 10.02015019, 10.0367983 ,\n",
       "       10.0538455 , 10.08516445, 10.06009158, 10.02796777, 10.02624238,\n",
       "       10.00897855, 10.04095382, 10.05745549, 10.08568587, 10.01905264,\n",
       "        9.99963101, 10.07015272, 10.10501349, 10.06128651, 10.00989939,\n",
       "       10.09272378, 10.07420202, 10.0664764 , 10.06036024, 10.09310662,\n",
       "       10.04498703, 10.04692886, 10.05133267,  9.99921788, 10.05831288,\n",
       "       10.00624852, 10.08646487, 10.05462199, 10.01565244, 10.03539014,\n",
       "       10.08844232, 10.05083593, 10.09796067, 10.0801992 , 10.05330196,\n",
       "       10.01714204, 10.07683129, 10.08021496, 10.01195317, 10.09042768,\n",
       "       10.07622151, 10.09264727, 10.0952152 ,  9.98610573,  9.99033778,\n",
       "       10.0080799 , 10.05187334, 10.01892386,  9.99828531, 10.0819808 ,\n",
       "       10.06927031, 10.03493712, 10.02362508, 10.06236062,  9.98187626,\n",
       "        9.97327168, 10.00791796, 10.0249473 , 10.01963251, 10.02945724,\n",
       "        9.99040239, 10.0463824 , 10.02981257, 10.03700987, 10.06879496,\n",
       "        9.96601166, 10.04165217, 10.03207134, 10.01557873, 10.00792785,\n",
       "       10.00318274, 10.02016466,  9.98718001,  9.99866319, 10.04189898,\n",
       "       10.03379797,  9.96719685,  9.98357866, 10.00256745,  9.9998615 ,\n",
       "        9.96977321,  9.97089386, 10.02970421, 10.03237391,  9.94292546,\n",
       "        9.99301875,  9.96762731, 10.01974229,  9.98328922,  9.95802328,\n",
       "        9.96302881,  9.98650678,  9.98955679,  9.93347461, 10.00372208,\n",
       "        9.96363556, 10.04023048, 10.04242398,  9.98996539,  9.98109686,\n",
       "        9.95785001,  9.96325144,  9.92625579,  9.99201428,  9.96686392,\n",
       "        9.92748613, 10.00639399, 10.02112396,  9.94377808,  9.97618317,\n",
       "       10.01698844, 10.02639706,  9.92326834, 10.00300272,  9.92919207,\n",
       "        9.98980078,  9.9316117 ,  9.94773449,  9.98565559,  9.91742741,\n",
       "        9.97446152,  9.93748815,  9.93182822, 10.01558789,  9.96924389,\n",
       "        9.96461265,  9.93160784,  9.95423278,  9.91559774,  9.9666531 ,\n",
       "        9.96182044, 10.00172046,  9.9214637 ,  9.97779975,  9.96455399,\n",
       "        9.9540168 ,  9.98794767,  9.92138843,  9.92659047,  9.99825603,\n",
       "        9.99249825,  9.92415283,  9.9757117 ,  9.92975288,  9.95030922,\n",
       "        9.97205124,  9.93832707, 10.00926589,  9.96646854,  9.96412222,\n",
       "        9.94788279,  9.98593681,  9.99584831, 10.00997687,  9.99056464,\n",
       "        9.95759797,  9.95838071, 10.02494092,  9.99605195,  9.99789107,\n",
       "        9.97588204,  9.96689061, 10.01797011,  9.96340434,  9.96041707,\n",
       "        9.92586716,  9.94356128,  9.98689452,  9.93565418,  9.94990274,\n",
       "        9.96688422,  9.95791834,  9.97831526,  9.94918417, 10.02060248,\n",
       "        9.99581291,  9.93670765,  9.93310473,  9.98474087, 10.02043739,\n",
       "        9.98345313,  9.95584043,  9.97535403,  9.95875395,  9.93553125,\n",
       "        9.96047667, 10.02872518, 10.00777725, 10.01978685,  9.98076032,\n",
       "        9.93385836, 10.04136698, 10.04126812,  9.99706166,  9.96927105,\n",
       "       10.00604302, 10.02060404,  9.96631966,  9.99867638, 10.02773128,\n",
       "       10.03056051,  9.96066389,  9.95610527, 10.03562027, 10.00757434,\n",
       "        9.95040944, 10.063221  ,  9.97617021, 10.03758978, 10.00925251,\n",
       "        9.99285594, 10.0282801 , 10.00393661,  9.97853902,  9.97296571,\n",
       "       10.04996773, 10.03505074, 10.00802569, 10.05330384,  9.97415377,\n",
       "       10.00564999, 10.02966799, 10.01984638,  9.98460313, 10.00164946,\n",
       "       10.02726961, 10.02699127,  9.96348372, 10.06589228,  9.98007209,\n",
       "       10.03115809, 10.02988799,  9.98717213, 10.0715891 , 10.05564556,\n",
       "       10.03698485, 10.01323106, 10.04166778, 10.04220526, 10.0065132 ,\n",
       "        9.98784497, 10.05202717, 10.00081387, 10.02606639,  9.99966668,\n",
       "       10.02345777,  9.96846284,  9.97582301, 10.01705803, 10.04897136,\n",
       "       10.00595699, 10.02838726,  9.99588728, 10.05316275,  9.97360992,\n",
       "       10.04557686, 10.00188146,  9.99363396,  9.98866008, 10.06019576,\n",
       "        9.99457807,  9.99231184, 10.05776844, 10.0024875 , 10.00011369,\n",
       "       10.01431402,  9.98862905, 10.0296633 , 10.06099633, 10.06563324,\n",
       "        9.98498559, 10.04795044,  9.99158999,  9.96356337, 10.03356596,\n",
       "        9.98818281, 10.06927178,  9.9688759 ,  9.98311394, 10.00103348,\n",
       "       10.0429925 , 10.047851  ,  9.96851163, 10.0254582 ,  9.99239944,\n",
       "       10.04272587, 10.0492096 , 10.00091864, 10.05219985,  9.96644073,\n",
       "       10.0445711 ,  9.99437522, 10.0256909 ,  9.99433282,  9.96812353,\n",
       "        9.97361177, 10.03420171,  9.97295436, 10.03021671, 10.01862502,\n",
       "       10.02906583,  9.96595397, 10.01488716,  9.9875142 , 10.04245756,\n",
       "       10.05392053, 10.03107492,  9.99284998,  9.98612105,  9.99783096,\n",
       "        9.96073251,  9.95097423,  9.97290459,  9.95048797, 10.00948498])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_meas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
